home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1991 …esperately Seeking Seven / Desperately Seeking Seven.2mg / Dev.CD.8 / Essentials / Tools / DTS.Samples / SC11PrRecordSpy / PrRec.Spy.asm < prev    next >
Encoding:
Assembly Source File  |  1990-08-07  |  50.6 KB  |  1,464 lines  |  [04] ASCII Text (0x0000)

  1. *******************************************************************************
  2. *
  3. * Print Record Spy -- Version 3.1
  4. *
  5. * (C)  Copyright Apple Computer, Inc. 1988-1990
  6. * All rights reserved.
  7. *
  8. * Developer Technical Support Apple II Sample Code
  9. *
  10. * by Keith Rollin
  11. * based on a story by Scott 'ZZ' Zimmerman
  12. *
  13. * This program lets the avid and interested user examine the various
  14. * fields of the Print Record used by the Print Manager.  Menu items let you
  15. * call Print Manager routines, and this program will display the values from
  16. * the resulting print record in a window. It also keeps track of past values
  17. * of the print record, and notes the fields that have changed by displaying
  18. * them in Boldface. A second window displays the past values so you can
  19. * compare them with the changed values side by side.
  20. *
  21. *******************************************************************************
  22.                     eject
  23.                     
  24. **********************************************************************
  25. *                                                                    *
  26. *             Apple IIGS Source Code Sampler, Volume I               *
  27. *                                                                    *
  28. *           Copyright (c) Apple Computer, Inc. 1988-1990             *
  29. *                       All Rights Reserved                          *
  30. *                                                                    *
  31. *            Written by Apple II Developer Tech Support              *
  32. *                                                                    *
  33. *                                                                    *
  34. *                                                                    *
  35. *  ----------------------------------------------------------------  *
  36. *                                                                    *
  37. *     This program and its derivatives are licensed only for         *
  38. *     use on Apple computers.                                        *
  39. *                                                                    *
  40. *     Works based on this program must contain and                   *
  41. *     conspicuously display this notice.                             *
  42. *                                                                    *
  43. *     This software is provided for your evaluation and to           *
  44. *     assist you in developing software for the Apple IIGS           *
  45. *     computer.                                                      *
  46. *                                                                    *
  47. *     DISCLAIMER OF WARRANTY                                         *
  48. *                                                                    *
  49. *     THE SOFTWARE IS PROVIDED "AS IS" WITHOUT                       *
  50. *     WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,               *
  51. *     WITH RESPECT TO ITS MERCHANTABILITY OR ITS FITNESS             *
  52. *     FOR ANY PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO             *
  53. *     THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH            *
  54. *     YOU.  SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU (AND            *
  55. *     NOT APPLE OR AN APPLE AUTHORIZED REPRESENTATIVE)               *
  56. *     ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING,             *
  57. *     REPAIR OR CORRECTION.                                          *
  58. *                                                                    *
  59. *     Apple does not warrant that the functions                      *
  60. *     contained in the Software will meet your requirements          *
  61. *     or that the operation of the Software will be                  *
  62. *     uninterrupted or error free or that defects in the             *
  63. *     Software will be corrected.                                    *
  64. *                                                                    *
  65. *     SOME STATES DO NOT ALLOW THE EXCLUSION                         *
  66. *     OF IMPLIED WARRANTIES, SO THE ABOVE EXCLUSION MAY              *
  67. *     NOT APPLY TO YOU.  THIS WARRANTY GIVES YOU SPECIFIC            *
  68. *     LEGAL RIGHTS AND YOU MAY ALSO HAVE OTHER RIGHTS                *
  69. *     WHICH VARY FROM STATE TO STATE.                                *
  70. *                                                                    *
  71. *                                                                    *
  72. **********************************************************************
  73.                     eject
  74.                     
  75.                     case   on
  76.  
  77.                     copy 2/ainclude/E16.Quickdraw
  78.                     copy 2/ainclude/E16.Memory
  79.                     copy 2/ainclude/E16.Window
  80.                     copy 2/ainclude/E16.Dialog
  81.                     copy 2/ainclude/E16.Print
  82.                     mcopy macros/prrec.spy.macs
  83.  
  84. *******************************************************************************
  85. *
  86. *    Equates used in this program.
  87. *
  88. *******************************************************************************
  89. DPHandle            gequ 0              ; Handle to Tool Direct Page area
  90. DPPointer           gequ DPHandle+4     ; Pointer to Tool Direct Page area
  91. deref               gequ DPPointer+4    ; Temprary Handle dereference area
  92. Temp1               gequ deref+4
  93. Temp2               gequ Temp1+4
  94.  
  95. ScreenMode          gequ mode640
  96. ScreenWidth         gequ 640
  97.  
  98.  
  99.                     EJECT
  100. *******************************************************************************
  101. *
  102. Main                start
  103. *
  104. * Description:      This is the main routine. It calls routines to Initialize
  105. *                   the tools, initialize application specific data, run the
  106. *                   main EventLoop, close the application, and close the tools.
  107. *                   Then it calls the ProDOS Quit command.
  108. *
  109. *
  110. * Inputs:           NONE
  111. *
  112. * Outputs:          NONE
  113. *
  114. * External Refs:
  115. *                   Import InitTools
  116. *                   Import InitApp
  117. *                   Import EventLoop
  118. *                   Import CloseApp
  119. *                   Import CloseTools
  120. *                   Import QuitParms
  121. *
  122. * Entry Points:     NONE
  123. *
  124. *******************************************************************************
  125.  
  126.                     jsr InitTools
  127.                     jsr InitApp
  128.  
  129.                     _ShowCursor
  130.  
  131.                     jsr EventLoop
  132.                     jsr CloseApp
  133.                     jsr CloseTools
  134.  
  135.                     _Quit QuitParms
  136.  
  137.                     end
  138.  
  139.                     EJECT
  140. *******************************************************************************
  141. *
  142. Globals             data
  143. *
  144. * Description:      Holder of all of our data.
  145. *
  146. *
  147. * Inputs:           N/A
  148. *
  149. * Outputs:          N/A
  150. *
  151. * External Refs:
  152. *                   Import PrUpdate
  153. *                   Import PrOldUpdate
  154. *
  155. * Entry Points:
  156. *                   Export QuitParms    ; used by Main
  157. *
  158. *******************************************************************************
  159. *
  160. * Standard global data
  161. *
  162. *******************************************************************************
  163.  
  164. TitleString         str 'Print Record Spy - Shows effects of Print Manager calls'
  165. AutString           str 'By Keith Rollin Apple DTS -- Version: 3.1'
  166. VersString          str 'Copyright (c) 1988-1990 Apple Computer'
  167.  
  168. MenuHeight          ds 2                ; Stored height of menu bar
  169. MyID                ds 2                ; Application ID
  170. MyDP                ds 2                ; My direct page storage
  171.  
  172. QuitFlag            ds 2
  173. QuitParms           dc i4'0'            ; Pathname of next app
  174.                     dc i2'$00'          ; flags
  175.  
  176. EventRecord         ANOP
  177. EventWhat           ds 2
  178. EventMessage        ds 4
  179. EventWhen           ds 4
  180. EventWhere          ds 4
  181. EventModifiers      ds 2
  182. TaskData            ds 4
  183. TaskMask            dc i4'$0000FFFF'
  184.  
  185.                     EJECT
  186. *******************************************************************************
  187. *
  188. * Application specific global data
  189. *
  190. *******************************************************************************
  191.  
  192. ; This is a list of pointers to the text that is used to create our menus. It
  193. ; is used by InitApp to find all of the menu templates and use them to create
  194. ; our menubar. This loop loads MenuPtrLen-4 into an index, gets the
  195. ; corresponding menu template pointer in this table, and uses that in a
  196. ; NewMenu call. It then decrements the index by 4, and repeats the procees
  197. ; until the index is negative.
  198.  
  199. MenuPtr             dc i4'AppMenu'
  200.                     dc i4'FileMenu'
  201.                     dc i4'EditMenu'
  202. MenuPtrLen          equ *-MenuPtr
  203.  
  204.  
  205. ; Menu list: menu items should be numbered consecutivly starting from 250.
  206. ; As a convention, use 256 as about and 257 as Quit.
  207.  
  208. AppMenu             dc c'$$@\XN1',i1'$0D'
  209.                     dc c'--About Print Record Spy...\VN256',i1'$0D'
  210.                     dc c'.'
  211. FileMenu            dc c'$$  File  \N2',i1'$0D'
  212.                     dc c'--Choose Printer\N258',i1'$00'
  213.                     dc c'--Page Setup\N259',i1'$00'
  214.                     dc c'--Job Dialog\N260',i1'$00'
  215.                     dc c'--PrDefault\N261',i1'$00'
  216.                     dc c'--PrValidate\VN262',i1'$00'
  217.                     dc c'--Quit\N257*Qq',i1'$0D'
  218.                     dc c'.'
  219. EditMenu            dc c'$$  Edit  \N3',i1'$00'
  220.                     dc c'--Undo\N250*ZzVD',i1'$00'
  221.                     dc c'--Cut\N251*XxD',i1'$00'
  222.                     dc c'--Copy\N252*CcD',i1'$00'
  223.                     dc c'--Paste\N253*VvD',i1'$00'
  224.                     dc c'--Clear\N254D',i1'$00'
  225.                     dc c'.'
  226.  
  227. ;
  228. ; Parameters lists for my two windows
  229. ;
  230. wTitle1             str '  Current Settings  '
  231. MyWindow            dc i2'WindEnd-MyWindow' ; size of paramBlock
  232.                     dc i2'fVis+fTitle+fBScroll+fRScroll+fGrow+fMove+fZoom'
  233.                     dc i4'wTitle1'      ; no title bar, no title...
  234.                     dc i4'0'            ; RefCon
  235.                     dc i2'30,60,185,580'                    ; zoomed rect
  236.                     dc i4'0'            ; color table = default
  237.                     dc i2'0,0'          ; scroll bar XY origin
  238.                     dc i2'155,520'      ; scroll max.
  239.                     dc i2'155,520'      ; Max Height/Width.
  240.                     dc i2'40,40'        ; scroll values
  241.                     dc i2'0,0'          ; page values (default)
  242.                     dc i4'0'            ; no info bar RefCon
  243.                     dc i2'0'            ; info bar height (none)
  244.                     dc i4'0'            ; Frame defproc, NIL=standard
  245.                     dc i4'0'            ; no info bar def proc
  246.                     dc i4'PrUpdate'     ; auto updates
  247.                     dc i2'30,10,185,290'                    ; bounds rect.
  248.                     dc i4'$FFFFFFFF'    ; plane= on top.
  249.                     dc i4'0'            ; NIL storage pointer
  250. WindEnd             equ *
  251.  
  252. wTitle2             str '  Previous Settings  '
  253. MyWindow2           dc i2'WindEnd2-MyWindow2' ; size of paramBlock
  254.                     dc i2'fVis+fTitle+fBScroll+fRScroll+fGrow+fMove+fZoom'
  255.                     dc i4'wTitle2'      ; no title bar, no title...
  256.                     dc i4'0'            ; RefCon
  257.                     dc i2'30,60,185,580'                    ; zoomed rect
  258.                     dc i4'0'            ; color table = default
  259.                     dc i2'0,0'          ; scroll bar XY origin
  260.                     dc i2'155,520'      ; scroll max.
  261.                     dc i2'155,520'      ; Max Height/Width.
  262.                     dc i2'40,40'        ; scroll values
  263.                     dc i2'0,0'          ; page values (default).
  264.                     dc i4'0'            ; no info bar RefCon
  265.                     dc i2'0'            ; info bar height (none)
  266.                     dc i4'0'            ; Frame defproc, NIL=standard
  267.                     dc i4'0'            ; no info bar def proc
  268.                     dc i4'PrOldUpdate'  ; auto updates
  269.                     dc i2'30,330,185,610'                   ; bounds rect.
  270.                     dc i4'$FFFFFFFF'    ; plane= on top.
  271.                     dc i4'0'            ; NIL storage pointer
  272. WindEnd2            equ *
  273.  
  274.  
  275. WindPointer         ds 4
  276. WindPointer2        ds 4
  277.  
  278. BigRect             dc i2'0,0,200,640'
  279. PrintRecord         ds 4
  280. OldRecord           ds 4
  281. PrinterPort         ds 4
  282.  
  283.  
  284. ; Big hunkin' chunk of data that I use to print the strings. These are
  285. ; their X/Y coordinates.
  286.  
  287. Position            dc i2'10,10'        ; Print Record
  288.                     dc i2'270,10'       ; Printer Information
  289.                     dc i2'270,70'       ; Job SubRecord
  290.                     dc i2'10,80'        ; Style SubRecord
  291.                     dc i2'20,20'        ; prVersion
  292.                     dc i2'20,30'        ; prInfo
  293.                     dc i2'20,40'        ; rPaper
  294.                     dc i2'20,50'        ; prStl
  295.                     dc i2'20,60'        ; prJob
  296.                     dc i2'280,20'       ; iDev
  297.                     dc i2'280,30'       ; iVRes
  298.                     dc i2'280,40'       ; iHRes
  299.                     dc i2'280,50'       ; rPage
  300.                     dc i2'20,90'        ; wDev
  301.                     dc i2'20,100'       ; feed
  302.                     dc i2'20,110'       ; paperType
  303.                     dc i2'20,120'       ; crWidth/vSizing
  304.                     dc i2'20,130'       ; reduction
  305.                     dc i2'280,80'       ; iFstPage
  306.                     dc i2'280,90'       ; iLstPage
  307.                     dc i2'280,100'      ; iCopies
  308.                     dc i2'280,110'      ; bJDocLoop
  309.                     dc i2'280,120'      ; pIdleProc
  310.                     dc i2'280,130'      ; pFileName
  311.                     dc i2'280,140'      ; iFileVol
  312.                     dc i2'280,150'      ; bFileVers
  313.  
  314.  
  315. ; Big hunkin' chunk of data that I use to print the record's values.
  316. ; The Low word is the offset into the print record that I'm interested
  317. ; in. The high word contains the length of the field that I'm printing. If
  318. ; it's Zero, then no values get printed at all. For instance, some
  319. ; strings don't get any values printed after them.
  320.  
  321. ValueOffsets        dc i4'$00000000'    ; Print Record
  322.                     dc i4'$00000000'    ; Printer Information
  323.                     dc i4'$00000000'    ; Job SubRecord
  324.                     dc i4'$00000000'    ; Style SubRecord
  325.                     dc i4'$00020000'    ; prVersion
  326.                     dc i4'$00000000'    ; prInfo
  327.                     dc i4'$00080010'    ; rPaper
  328.                     dc i4'$00000000'    ; prStl
  329.                     dc i4'$00000000'    ; prJob
  330.                     dc i4'$00020002'    ; iDev
  331.                     dc i4'$00020004'    ; iVRes
  332.                     dc i4'$00020006'    ; iHRes
  333.                     dc i4'$00080008'    ; rPage
  334.                     dc i4'$00020018'    ; wDev
  335.                     dc i4'$00020020'    ; feed
  336.                     dc i4'$00020022'    ; paperType
  337.                     dc i4'$00020024'    ; crWidth/vSizing
  338.                     dc i4'$00020026'    ; reduction
  339.                     dc i4'$00020050'    ; iFstPage
  340.                     dc i4'$00020052'    ; iLstPage
  341.                     dc i4'$00020054'    ; iCopies
  342.                     dc i4'$00010056'    ; bJDocLoop
  343.                     dc i4'$00040059'    ; pIdleProc
  344.                     dc i4'$0004005D'    ; pFileName
  345.                     dc i4'$00020051'    ; iFileVol
  346.                     dc i4'$00010053'    ; bFileVers
  347.  
  348.  
  349. ; Table of pointers to all of my strings. A loop is used to go through
  350. ; this and print them all out.
  351.  
  352. TitleTable          dc i4'Title1,Title2,Title3,Title4'
  353.                     dc i4'Title5,Title6,Title7,Title8'
  354.                     dc i4'Title9,Title10,Title11,Title12'
  355.                     dc i4'Title13,Title14,Title15,Title16'
  356.                     dc i4'Title17,Title18,Title19,Title20'
  357.                     dc i4'Title21,Title22,Title23,Title24'
  358.                     dc i4'Title25,Title26'
  359.  
  360.  
  361. ; Da Strings! NOTE: Title17x is special cased in the window printing
  362. ; routine, so it isn't included in the above table.
  363.  
  364. Title1              str 'Print Record'
  365. Title2              str 'Printer Information'
  366. Title3              str 'Job SubRecord'
  367. Title4              str 'Style SubRecord'
  368. Title5              str 'prVersion = '
  369. Title6              str 'prInfo = See Printer Information'
  370. Title7              str 'rPaper = '
  371. Title8              str 'prStl = See Style SubRecord'
  372. Title9              str 'prJob = See Job SubRecord'
  373. Title10             str 'iDev = '
  374. Title11             str 'iVRes = '
  375. Title12             str 'iHRes = '
  376. Title13             str 'rPage = '
  377. Title14             str 'wDev = '
  378. Title15             str 'feed = '
  379. Title16             str 'paperType = '
  380. Title17             str 'crWidth = '
  381. Title17x            str 'vSizing = '
  382. Title18             str 'reduction = '
  383. Title19             str 'iFstPage = '
  384. Title20             str 'iLstPage = '
  385. Title21             str 'iCopies = '
  386. Title22             str 'bJDocLoop = '
  387. Title23             str 'pIdleProc = '
  388. Title24             str 'pFileName = '
  389. Title25             str 'iFileVol = '
  390. Title26             str 'bFileVers = '
  391.  
  392.  
  393. ExtraString         ds 2
  394.  
  395. DriverChanged       str 'The Driver was changed.'
  396. DriverDidntChange   str 'The Driver was not changed.'
  397. Confirmed           str 'The OK Button was pressed.'
  398. Canceled            str 'The Cancel Button was pressed.'
  399. RecordChanged       str 'The Print Record changed.'
  400. RecordNotChanged    dc i1'31'
  401.                     dc c'The Print Record didn''t change.'
  402.  
  403.                     end
  404.  
  405.                     copy spy.stds.asm
  406.  
  407.                     EJECT
  408. *******************************************************************************
  409. *
  410. InitApp             start
  411. *
  412. * Description:      Create my windows, and get two handles for print records
  413. *                   and initialize them.
  414. *
  415. * Inputs:           NONE
  416. *
  417. * Outputs:          NONE
  418. *
  419. * External Refs:    NONE
  420. *
  421. * Entry Points:     NONE
  422. *
  423. *******************************************************************************
  424.                     using Globals
  425.  
  426.                     stz QuitFlag
  427.  
  428.                     pha                 ; Create the windows that will show
  429.                     pha                 ; the print records
  430.                     PushLong #MyWindow2
  431.                     _NewWindow
  432.                     PullLong WindPointer2
  433.  
  434.                     pha                 ; space for result (window pointer)
  435.                     pha
  436.                     PushLong #MyWindow
  437.                     _NewWindow
  438.                     PullLong WindPointer
  439.  
  440.                     PushLong WindPointer ; Set the port to one of them
  441.                     _SetPort
  442.  
  443. ;
  444. ; Get a couple of handles to hold my print records
  445. ;
  446.                     pha                 ; space for result
  447.                     pha
  448.                     PushLong #140       ; size of print record
  449.                     PushWord MyID       ; put it to my name
  450.                     PushWord #attrLocked+attrNoCross
  451.                     PushLong #0         ; address for attributes
  452.                     _NewHandle          ; get the handle
  453.                     PullLong PrintRecord ; save the handle
  454.  
  455.                     pha
  456.                     pha
  457.                     PushLong #140       ; Size of print record
  458.                     PushWord MyID
  459.                     PushWord #attrLocked+attrNoCross
  460.                     PushLong #0
  461.                     _NewHandle
  462.                     PullLong OldRecord
  463.  
  464. ;
  465. ; Finally, call the print manager to set default values in the
  466. ; print records
  467. ;
  468.                     PushLong PrintRecord
  469.                     _PrDefault
  470.  
  471.                     PushLong OldRecord
  472.                     _PrDefault
  473.  
  474.                     rts
  475.                     end
  476.  
  477.                     EJECT
  478. *******************************************************************************
  479. *
  480. CloseApp            start
  481. *
  482. * Description:      Close down things. This disposes of all items and memory
  483. *                   that we allocated.
  484. *
  485. *
  486. * Inputs:           NONE
  487. *
  488. * Outputs:          NONE
  489. *
  490. * External Refs:    NONE
  491. *
  492. * Entry Points:     NONE
  493. *
  494. *******************************************************************************
  495.                     using Globals
  496.  
  497.                     PushLong PrintRecord
  498.                     _DisposeHandle
  499.  
  500.                     PushLong OldRecord
  501.                     _DisposeHandle
  502.  
  503.                     PushLong WindPointer
  504.                     _CloseWindow
  505.  
  506.                     PushLong WindPointer2
  507.                     _CloseWindow
  508.  
  509.                     rts
  510.                     end
  511.  
  512.                     EJECT
  513. *******************************************************************************
  514. *
  515. EventLoop           start
  516. *
  517. * Description:      Main Event Loop. Handle things until user selects Quit.
  518. *
  519. *
  520. * Inputs:           NONE
  521. *
  522. * Outputs:          NONE
  523. *
  524. * External Refs:
  525. *                   Import MenuSelect
  526. *                   Import Ignore
  527. *
  528. * Entry Points:     NONE
  529. *
  530. *******************************************************************************
  531.                     using Globals
  532.  
  533.                     pha                 ; Push on space for TaskMaster result
  534.                     PushWord #$FFFF     ; GetNextEvent mask
  535.                     PushLong #EventRecord
  536.                     _TaskMaster
  537.  
  538.                     pla                 ; Get TaskMaster result
  539.                     beq EventLoop       ; Remove if you want to use null events
  540.                     asl A               ; Turn it into an index
  541.                     tax
  542.                     jsr (TaskTable,x)   ; Call appropriate event handler
  543.  
  544.                     lda QuitFlag        ; Quit selected?
  545.                     beq EventLoop       ; no - keep looping
  546.  
  547.                     rts                 ; yes- leave the program
  548.  
  549. TaskTable           dc i2'Ignore'       ; 0 Null
  550.                     dc i2'Ignore'       ; 1 MouseDown
  551.                     dc i2'Ignore'       ; 2 MouseUp
  552.                     dc i2'Ignore'       ; 3 KeyDown
  553.                     dc i2'Ignore'       ; 4 undefined
  554.                     dc i2'Ignore'       ; 5 AutoKey
  555.                     dc i2'Ignore'       ; 6 Update
  556.                     dc i2'Ignore'       ; 7 undefined
  557.                     dc i2'Ignore'       ; 8 Activate
  558.                     dc i2'Ignore'       ; 9 Switch
  559.                     dc i2'Ignore'       ; 10 Desk accessory
  560.                     dc i2'Ignore'       ; 11 Device driver
  561.                     dc i2'Ignore'       ; 12 ap
  562.                     dc i2'Ignore'       ; 13 ap
  563.                     dc i2'Ignore'       ; 14 ap
  564.                     dc i2'Ignore'       ; 15 ap
  565.                     dc i2'Ignore'       ; TASK 0 indesk
  566.                     dc i2'MenuSelect'   ; TASK 1 in menuBar
  567.                     dc i2'Ignore'       ; TASK 2 in system window
  568.                     dc i2'Ignore'       ; TASK 3 in content
  569.                     dc i2'Ignore'       ; TASK 4 in Drag
  570.                     dc i2'Ignore'       ; TASK 5 in grow
  571.                     dc i2'Ignore'       ; TASK 6 in goaway
  572.                     dc i2'Ignore'       ; TASK 7 in zoom
  573.                     dc i2'Ignore'       ; TASK 8 in info bar
  574.                     dc i2'Ignore'       ; TASK 9 in special menu
  575.                     dc i2'Ignore'       ; TASK 10 in NDA
  576.                     dc i2'Ignore'       ; TASK 11 in frame
  577.                     dc i2'Ignore'       ; TASK 12 in drop
  578.  
  579.                     end
  580.  
  581.                     EJECT
  582. *******************************************************************************
  583. *
  584. MenuSelect          start
  585. *
  586. * Description:      Menu item has been selected. Call the appropriate routine
  587. *                   and unhilite the menu when it is done. Before doing so,
  588. *                   however, a check is made to see if the routine being called
  589. *                   could possibly change the state of the Print Record. If it
  590. *                   can, a copy of the current print record is made. This way
  591. *                   we can see how the routine called changed the record.
  592. *
  593. * Inputs:           TaskData holds menu item selected.
  594. *
  595. * Outputs:          NONE
  596. *
  597. * External Refs:
  598. *                   Import Ignore
  599. *                   Import doAbout
  600. *                   Import doQuit
  601. *                   Import doPrChoose
  602. *                   Import doPrPgSetup
  603. *                   Import doPrJobDialog
  604. *                   Import doPrDefault
  605. *                   Import doPrValidate
  606. *                   Import ClearOldRecord
  607. *
  608. * Entry Points:     NONE
  609. *
  610. *******************************************************************************
  611.                     using Globals
  612.  
  613.                     lda TaskData        ; See if this call can change the
  614.                     cmp #258            ; print record.
  615.                     bcc Dispatch        ; No - it can't. Just call the routine.
  616.  
  617.                     jsr ClearOldRecord  ; Yes - so make a copy of it
  618. Dispatch            ANOP
  619.                     lda TaskData        ; Fet the ID of the menu item selected.
  620.                     sec                 ; Turn it into an index.
  621.                     sbc #250
  622.                     asl a
  623.                     tax
  624.                     jsr (MenuTable,x)   ; Call the routine behind it.
  625.  
  626.                     PushWord #0         ; Routine done - unhilite the menubar.
  627.                     lda TaskData+2
  628.                     pha
  629.                     _HiLiteMenu
  630.  
  631.                     rts
  632.  
  633. MenuTable           dc i2'Ignore'       ; undo
  634.                     dc i2'Ignore'       ; cut
  635.                     dc i2'Ignore'       ; copy
  636.                     dc i2'Ignore'       ; paste
  637.                     dc i2'Ignore'       ; clear
  638.                     dc i2'Ignore'       ; close
  639.                     dc i2'doAbout'
  640.                     dc i2'doQuit'
  641.                     dc i2'doPrChoose'
  642.                     dc i2'doPrPgSetup'
  643.                     dc i2'doPrJobDialog'
  644.                     dc i2'doPrDefault'
  645.                     dc i2'doPrValidate'
  646.                     end
  647.                     EJECT
  648. *******************************************************************************
  649. *
  650. Ignore              start
  651. *
  652. * Description:      Called when I want to ignore an event.
  653. *
  654. *
  655. * Inputs:           NONE
  656. *
  657. * Outputs:          NONE
  658. *
  659. * External Refs:    NONE
  660. *
  661. * Entry Points:     NONE
  662. *
  663. *******************************************************************************
  664.  
  665.                     rts
  666.                     end
  667.  
  668.                     EJECT
  669. *******************************************************************************
  670. *
  671. doQuit              start
  672. *
  673. * Description:      Quit routine. Set the QuitFlag to TRUE for the EventLoop.
  674. *
  675. *
  676. * Inputs:           NONE
  677. *
  678. * Outputs:          QuitFlag set to $FFFF
  679. *
  680. * External Refs:    NONE
  681. *
  682. * Entry Points:     NONE
  683. *
  684. *******************************************************************************
  685.                     using Globals
  686.  
  687.                     lda #$FFFF
  688.                     sta QuitFlag
  689.                     rts
  690.                     end
  691.  
  692.                     EJECT
  693. *******************************************************************************
  694. *
  695. doPrChoose          start
  696. *
  697. * Description:      Called by MenuSelect to call the routine to chooose a
  698. *                   printer. Also determine whether the print driver has
  699. *                   changed. When it is done, it calls ShowChanges to mark the
  700. *                   window as 'dirty', and prints a string to say whether or
  701. *                   not the driver has changed.
  702. *
  703. *
  704. * Inputs:           NONE
  705. *
  706. * Outputs:          NONE
  707. *
  708. * External Refs:
  709. *                   Import ShowChanges
  710. *
  711. * Entry Points:     NONE
  712. *
  713. *******************************************************************************
  714.                     using Globals
  715.  
  716.                     pha                 ; Bring up the Choose Printer dialog
  717.                     _PrChoosePrinter
  718.  
  719.                     jsr ShowChanges     ; Show any changes (shouldn't be any)
  720.  
  721.                     pla
  722.                     beq NotChanged
  723.  
  724.                     lda #DriverChanged  ; if TRUE then the driver changed
  725.                     bra done
  726. NotChanged          lda #DriverDidntChange ; if FALSE, it didn't
  727. done                sta ExtraString
  728.  
  729.                     rts
  730.                     end
  731.  
  732.                     EJECT
  733. *******************************************************************************
  734. *
  735. doPrPgSetup         start
  736. *
  737. * Description:      Called by MenuSelect to call the routine that does the page
  738. *                   setup. Also determines whether clicked on OK or not. When
  739. *                   it is done, it calls ShowChanges to mark the window as
  740. *                   'dirty', and prints a string to say whether or not the
  741. *                   user clicked on OK.
  742. *
  743. *
  744. * Inputs:           NONE
  745. *
  746. * Outputs:          NONE
  747. *
  748. * External Refs:
  749. *                   Import ShowChanges
  750. *
  751. * Entry Points:     NONE
  752. *
  753. *******************************************************************************
  754.                     using Globals
  755.  
  756.                     pha                 ; bring up the dialog
  757.                     PushLong PrintRecord
  758.                     _PrStlDialog
  759.  
  760.                     jsr ShowChanges     ; show any changes
  761.  
  762.                     pla
  763.                     beq CancelPressed
  764.  
  765.                     lda #Confirmed      ; TRUE:  pressed OK
  766.                     bra done
  767. CancelPressed       lda #Canceled       ; FALSE:  pressed Cancel
  768. done                sta ExtraString
  769.  
  770.                     rts
  771.                     end
  772.  
  773.                     EJECT
  774. *******************************************************************************
  775. *
  776. doPrJobDialog       start
  777. *
  778. * Description:      Called by MenuSelect to call the routine that brings up the
  779. *                   dialog that asks how many copies, page range, etc. Also
  780. *                   indcates if the user presses Cancel or OK. When it is done,
  781. *                   it calls ShowChanges to mark the window as 'dirty', and
  782. *                   prints a string to say whether or not the user clicked on
  783. *                   OK.
  784. *
  785. *
  786. * Inputs:           NONE
  787. *
  788. * Outputs:          NONE
  789. *
  790. * External Refs:
  791. *                   Import ShowChanges
  792. *
  793. * Entry Points:     NONE
  794. *
  795. *******************************************************************************
  796.                     using Globals
  797.  
  798.                     pha                 ; Bring up the Job Dialog
  799.                     PushLong PrintRecord
  800.                     _PrJobDialog
  801.  
  802.                     jsr ShowChanges     ; Show any changes
  803.  
  804.                     pla
  805.                     beq CancelPressed
  806.  
  807.                     lda #Confirmed      ; TRUE, so pressed OK
  808.                     bra done
  809. CancelPressed       lda #Canceled       ; FALSE, so pressed Cancel
  810. done                sta ExtraString
  811.  
  812.                     rts
  813.                     end
  814.  
  815.                     EJECT
  816. *******************************************************************************
  817. *
  818. doPrDefault         start
  819. *
  820. * Description:      Called by MenuSelect to ask the Print Driver to fill in
  821. *                   default values in the Print Record. This should be when an
  822. *                   application starts up and everytime the Print Driver is
  823. *                   changed (changing Printers does not automatically set up
  824. *                   correct values in the Print Record). When that is done,
  825. *                   ShowChanges is called to mark the window as 'dirty'.
  826. *
  827. *
  828. * Inputs:           NONE
  829. *
  830. * Outputs:          NONE
  831. *
  832. * External Refs:
  833. *                   Import ShowChanges
  834. *
  835. * Entry Points:     NONE
  836. *
  837. *******************************************************************************
  838.                     using Globals
  839.  
  840.                     PushLong PrintRecord
  841.                     _PrDefault
  842.  
  843.                     jsr ShowChanges
  844.  
  845.                     stz ExtraString     ; no extra string
  846.  
  847.                     rts
  848.                     end
  849.  
  850.                     EJECT
  851. *******************************************************************************
  852. *
  853. doPrValidate        start
  854. *
  855. * Description:      Called by MenuSelect to verify that there are correct
  856. *                   values in the Print record. If there are any that it
  857. *                   suspects, it will replace them with default values. Also,
  858. *                   PrValidate returns a boolean value to indicate if it
  859. *                   actually changed anything. ShowChanges is called to mark
  860. *                   the window as 'dirty', and a message is printed to say
  861. *                   whether or not anything was changed.
  862. *
  863. *
  864. * Inputs:           NONE
  865. *
  866. * Outputs:          NONE
  867. *
  868. * External Refs:
  869. *                   Import ShowChanges
  870. *
  871. * Entry Points:     NONE
  872. *
  873. *******************************************************************************
  874.                     using Globals
  875.  
  876.                     pha                 ; Validate the record
  877.                     PushLong PrintRecord
  878.                     _PrValidate
  879.  
  880.                     jsr ShowChanges     ; Show the changes
  881.  
  882.                     pla
  883.                     beq NoChange
  884.  
  885.                     lda #RecordChanged  ; TRUE, so yes it did change
  886.                     bra done
  887. NoChange            lda #RecordNotChanged ;FALSE, so no nothing changed
  888. done                sta ExtraString
  889.  
  890.                     rts
  891.                     end
  892.  
  893.                     EJECT
  894. *******************************************************************************
  895. *
  896. DerefIt             start
  897. *
  898. * Description:      Utility routine that dereferences and locks a handle.
  899. *
  900. *
  901. * Inputs:           A = Handle low
  902. *                   X = Handle high
  903. *
  904. * Outputs:          A = Pointer Low
  905. *                   X = Pointer high
  906. *
  907. * External Refs:    NONE
  908. *
  909. * Entry Points:     NONE
  910. *
  911. *******************************************************************************
  912.                     using Globals
  913.  
  914.                     sta deref           ; Put our handle into a Direct Page
  915.                     stx deref+2         ; location so we can use it as pointer.
  916.                     ldy #4              ; Get the Handle flags.
  917.                     lda [deref],y
  918.                     ora #$8000          ; Set the high bit to lock this handle.
  919.                     sta [deref],y       ; Store it back
  920.                     dey                 ; Now get the Master Pointer
  921.                     dey
  922.                     lda [deref],y
  923.                     tax                 ; return High Word in X
  924.                     lda [deref]         ; return Low Word in A
  925.                     rts
  926.                     end
  927.  
  928.                     EJECT
  929. *******************************************************************************
  930. *
  931. PrUpdate            start
  932. *
  933. * Description:      Update routine for the Print Record window. Loop through 26
  934. *                   strings, see if there are any Print Record fields asso-
  935. *                   ciated with them, and print them and the values out. If the
  936. *                   values have changed since the last Print Manager call, then
  937. *                   boldface the string.
  938. *
  939. *
  940. * Inputs:           NONE
  941. *
  942. * Outputs:          NONE
  943. *
  944. * External Refs:    NONE
  945. *
  946. * Entry Points:     NONE
  947. *
  948. *******************************************************************************
  949.                     using Globals
  950.  
  951. ; We are called from TaskMaster, with no guarantee as to the state of
  952. ; the data bank register or the direct page. Save off the ones that
  953. ; are passed to us, and set them up the way we like them.
  954.  
  955.                     phd                 ; save the Direct Page
  956.                     phb                 ; save the Data Bank Register
  957.  
  958.                     phk                 ; set the DBR to the program bank
  959.                     plb
  960.  
  961.                     lda MyDP            ; set the Direct Page to the main
  962.                     tcd                 ; application's Direct Page
  963.  
  964.                     lda PrintRecord     ; deref and lock the Print Record
  965.                     ldx PrintRecord+2
  966.                     jsr DerefIt
  967.                     sta Temp1
  968.                     stx Temp1+2
  969.  
  970.                     lda OldRecord       ; deref and lock the Previous P.R.
  971.                     ldx OldRecord+2
  972.                     jsr DerefIt
  973.                     sta Temp2
  974.                     stx Temp2+2
  975.  
  976.                     ldx #4*25           ; 4 times (number of strings - 1)
  977. loop                ANOP
  978.                     stx Index           ; Save the index into memory
  979.  
  980. ; Determine what this string represents (whether it identifies a field that
  981. ; has a changeable value or not) and find out if it did indeed change. If
  982. ; so, then set the fontface to BoldFace. If not, then set the fontface to
  983. ; plain.
  984.                     jsr SetFontStyle
  985.  
  986. ; Find out where this string is supposed to go and move there.
  987.  
  988.                     ldx Index
  989.                     PushWord Position,x
  990.                     PushWord Position+2,x
  991.                     _MoveTo
  992.  
  993. ;
  994. ; Prepare to print the string. This is normally just a lookup into
  995. ; a table of string pointers to get the one we want. However, we need
  996. ; to special case the name of one field, which changes depending on
  997. ; whether or not we are using a LaserWriter.
  998.  
  999.                     ldx Index
  1000.                     cpx #4*16           ; is the crWidth/vSizing one?
  1001.                     bne doNormal        ; no, so just draw it
  1002.  
  1003.                     ldy #oprInfo+oiDev  ; do we have a LaserWriter?
  1004.                     lda [Temp1],y
  1005.                     cmp #3
  1006.                     bne doNormal        ; yes, so use default string
  1007.  
  1008.                     PushLong #Title17x  ; no, so substitute in Special String
  1009.                     bra DrawTitle       ; now print it
  1010. doNormal            ANOP
  1011.                     PushLong TitleTable,x ; put on the normal string
  1012. DrawTitle           ANOP
  1013.                     _DrawString         ; print the string
  1014.  
  1015.                     jsr PrintValues     ; print the field's values
  1016.  
  1017. ; Now see if there is an extra message to print. If so, then do it.
  1018.  
  1019.                     lda ExtraString     ; is there one?
  1020.                     beq EndLoop         ; No, so skip over this next part.
  1021.  
  1022.                     PushWord #20        ; move to the right place
  1023.                     PushWord #150
  1024.                     _MoveTo
  1025.  
  1026.                     phk                 ; create a high order word out of
  1027.                     phk                 ; our program bank register.
  1028.                     pla
  1029.                     and #$00FF
  1030.                     pha
  1031.                     PushWord ExtraString ; push on the low order word.
  1032.                     _DrawString         ; draw the string.
  1033.  
  1034. EndLoop             ANOP
  1035.                     ldx Index           ; get our index back
  1036.                     dex                 ; bump to the next value
  1037.                     dex
  1038.                     dex
  1039.                     dex
  1040.                     bpl loop            ; keep going if still positive
  1041.  
  1042.                     plb                 ; restore the DBR...
  1043.                     pld                 ; ... and the Direct Page
  1044.  
  1045.                     rtl                 ; return back to TaskMaster
  1046.  
  1047. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1048. ;
  1049. ; If the item to be printed is one of the last 4, then it is a column
  1050. ; title. BoldFace it and leave. If it is not a column title, then see
  1051. ; if that part of the print record has changed. If so, then set the
  1052. ; font style to bold and leave. Otherwise, set the font style to normal.
  1053. ;
  1054.  
  1055. SetFontStyle        ANOP
  1056.                     PushWord #0         ; assume normal text
  1057.                     _SetTextFace
  1058.  
  1059.                     ldx Index
  1060.                     cpx #4*4            ; time to Bold for column headerss?
  1061.                     bge ckChange        ; no, see if print record changed
  1062.  
  1063.                     PushWord #%00001    ; turn on boldfacing
  1064.                     _SetTextFace
  1065.  
  1066.                     bra done2           ; and leave
  1067.  
  1068. ckChange            ANOP
  1069.                     lda ValueOffsets+2,x ; can this one change?
  1070.                     beq done2           ; no so don't check
  1071.                     sta count           ; check this many bytes
  1072.  
  1073.                     lda ValueOffsets,x  ; get location of field to check
  1074.                     tay
  1075.  
  1076.                     SHORTM              ; do the checks in 8-bit mode
  1077. ckChngLoop          ANOP
  1078.                     lda [Temp1],y       ; get the new byte
  1079.                     cmp [Temp2],y       ; check against the old
  1080.                     bne different       ; if even one's different, boldface it
  1081.                     iny                 ; bump to next byte to check
  1082.                     dec count           ; have we done them all?
  1083.                     bne ckChngLoop      ; no, so keep going
  1084.                     LONGM               ; back to 16-bit mode
  1085.                     bra done2           ; it didn't change so leave in normal mode
  1086.  
  1087. different           ANOP
  1088.                     LONGM               ; back to 16-bit mode
  1089.                     PushWord #%00001    ; item changed, bold it
  1090.                     _SetTextFace
  1091.  
  1092. done2               ANOP
  1093.                     rts
  1094.  
  1095.  
  1096. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1097. ;
  1098. ; Print out the record values.
  1099. ;
  1100.  
  1101. PrintValues         PushWord #0         ; normal text
  1102.                     _SetTextFace
  1103.  
  1104.                     ldx Index
  1105.                     lda ValueOffsets+2,x ; does this entry have field values
  1106.                     beq done            ; no so don't print anything
  1107.                     sta count           ; save the number of bytes to print
  1108.  
  1109.                     lda ValueOffsets,x  ; get location of bytes to print
  1110.                     tay
  1111.  
  1112. PrintValueLoop      sty YSave           ; Save this record index
  1113.                     lda [Temp1],y       ; get the byte
  1114.                     and #$00FF          ; mask off upper byte
  1115.  
  1116.                     pha                 ; push the value to be converted
  1117.                     PushLong #ValueString ; put the HEX string here
  1118.                     PushWord #2         ; length of output is 2
  1119.                     _Int2Hex            ; convert byte to a Hex string
  1120.  
  1121.                     PushLong #ValueString ; now print it
  1122.                     _DrawCString
  1123.  
  1124.                     dec count           ; have we done all of them?
  1125.                     beq done            ; yes, so leave
  1126.  
  1127.                     pea ','             ; no, so print a comma and do the next
  1128.                     _DrawChar
  1129.                     ldy YSave
  1130.                     iny
  1131.                     bra PrintValueLoop
  1132.  
  1133. done                ANOP
  1134.                     rts
  1135.  
  1136. Index               ds 2
  1137. YSave               ds 2
  1138. count               ds 2
  1139. OffSet              ds 2
  1140. ValueString         dc i1'0,0,0'
  1141.  
  1142.                     end
  1143.  
  1144.                     EJECT
  1145. *******************************************************************************
  1146. *
  1147. PrOldUpdate         start
  1148. *
  1149. * Description:      Update routine for the Previous record window. This is
  1150. *                   almost exactly the same as PrUpdate, but does not check to
  1151. *                   see if the old record has changed when it determines the
  1152. *                   font style for the strings. See that routine for comments.
  1153. *
  1154. *
  1155. * Inputs:           NONE
  1156. *
  1157. * Outputs:          NONE
  1158. *
  1159. * External Refs:    NONE
  1160. *
  1161. * Entry Points:     NONE
  1162. *
  1163. *******************************************************************************
  1164.                     using Globals
  1165.  
  1166.                     phd
  1167.                     phb
  1168.  
  1169.                     phk
  1170.                     plb
  1171.  
  1172.                     lda MyDP
  1173.                     tcd
  1174.  
  1175.                     lda PrintRecord
  1176.                     ldx PrintRecord+2
  1177.                     jsr DerefIt
  1178.                     sta Temp1
  1179.                     stx Temp1+2
  1180.  
  1181.                     lda OldRecord
  1182.                     ldx OldRecord+2
  1183.                     jsr DerefIt
  1184.                     sta Temp2
  1185.                     stx Temp2+2
  1186.  
  1187.                     ldx #4*25           ; 4 times number of strings - 1
  1188. loop                ANOP
  1189.                     stx Index
  1190.  
  1191.                     jsr SetFontStyle
  1192.  
  1193.                     ldx Index
  1194.                     lda Position,x
  1195.                     pha
  1196.                     lda Position+2,x
  1197.                     pha
  1198.                     _MoveTo
  1199.  
  1200.                     ldx Index
  1201.                     cpx #4*16           ; is the crWidth/Sizing one?
  1202.                     bne doNormal        ; no, so just draw it
  1203.  
  1204.                     ldy #oprInfo+oiDev  ; do we have a LaserWriter?
  1205.                     lda [Temp2],y
  1206.                     cmp #3
  1207.                     bne doNormal        ; yes, so use default string
  1208.  
  1209.                     PushLong #Title17x
  1210.                     bra DrawTitle
  1211. doNormal            ANOP
  1212.                     lda TitleTable+2,x
  1213.                     pha
  1214.                     lda TitleTable,x
  1215.                     pha
  1216. DrawTitle           ANOP
  1217.                     _DrawString
  1218.  
  1219.                     jsr PrintValues
  1220.  
  1221.                     ldx Index
  1222.                     dex
  1223.                     dex
  1224.                     dex
  1225.                     dex
  1226.                     bpl loop
  1227.  
  1228.                     plb
  1229.                     pld
  1230.  
  1231.                     rtl
  1232.  
  1233. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1234. ;
  1235. ; If the item to be printed is one of the last 4, then it is a column
  1236. ; title. BoldFace it and leave. If it is not a column title, then see
  1237. ; if that part of the print record has changed. If so, then set the
  1238. ; font style to italic and leave. Otherwise, set the font style to
  1239. ; normal.
  1240. ;
  1241.  
  1242. SetFontStyle        ANOP
  1243.                     PushWord #0         ; assume normal text
  1244.                     _SetTextFace
  1245.  
  1246.                     ldx Index
  1247.                     cpx #4*4            ; time to go to bold?
  1248.                     bge done2           ; no, see if print record changed
  1249.  
  1250.                     PushWord #%00001    ; turn on boldfacing
  1251.                     _SetTextFace
  1252.  
  1253. done2               ANOP
  1254.                     rts
  1255.  
  1256.  
  1257. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1258. ;
  1259. ; Print out the record values
  1260. ;
  1261.  
  1262. PrintValues         PushWord #0         ; normal text
  1263.                     _SetTextFace
  1264.  
  1265.                     ldx Index
  1266.                     lda ValueOffsets+2,x ; can this one change?
  1267.                     beq done            ; no so don't check
  1268.                     sta count
  1269.  
  1270.                     lda ValueOffsets,x
  1271.                     tay
  1272.  
  1273. PrintValueLoop      sty YSave           ; Save this record index
  1274.                     lda [Temp2],y
  1275.                     and #$00FF
  1276.  
  1277.                     pha                 ; push the value to be converted
  1278.                     PushLong #ValueString
  1279.                     PushWord #2         ; length of output is 2
  1280.                     _Int2Hex
  1281.  
  1282.                     PushLong #ValueString
  1283.                     _DrawCString
  1284.  
  1285.                     dec count           ; have we done all of them?
  1286.                     beq done            ; yes, so leave
  1287.  
  1288.                     pea ','             ; no, so print a comma and do the next
  1289.                     _DrawChar
  1290.                     ldy YSave
  1291.                     iny
  1292.                     bra PrintValueLoop
  1293.  
  1294. done                ANOP
  1295.                     rts
  1296.  
  1297. Index               ds 2
  1298. YSave               ds 2
  1299. count               ds 2
  1300. OffSet              ds 2
  1301. ValueString         dc i1'0,0,0'
  1302.  
  1303.                     end
  1304.  
  1305.                     EJECT
  1306. *******************************************************************************
  1307. *
  1308. ClearOldRecord      start
  1309. *
  1310. * Description:      We are about to make a call that could change the Print
  1311. *                   Record! Back up the current print record into the Previous
  1312. *                   Print Record.
  1313. *
  1314. *
  1315. * Inputs:           'PrintRecord' holds handle or record to back up
  1316. *                   'OldRecord' holds handle to back it up to
  1317. *
  1318. * Outputs:          'OldRecord' contains copy of 'PrintRecord' contents
  1319. *
  1320. * External Refs:    NONE
  1321. *
  1322. * Entry Points:     NONE
  1323. *
  1324. *******************************************************************************
  1325.                     using Globals
  1326.  
  1327.                     PushLong PrintRecord ; Source Handle
  1328.                     PushLong OldRecord  ; Destination Handle
  1329.                     PushLong #140       ; Length of the Source.
  1330.                     _HandToHand         ; Move it.
  1331.  
  1332.                     rts
  1333.                     end
  1334.  
  1335.                     EJECT
  1336. *******************************************************************************
  1337. *
  1338. ShowChanges         start
  1339. *
  1340. * Description:      We have made a call the could have changed the Print
  1341. *                   Record. Erase the old display of the print record, and mark
  1342. *                   the screen as invalid so that TaskMaster will update it
  1343. *                   with the new values.
  1344. *
  1345. *
  1346. * Inputs:           NONE
  1347. *
  1348. * Outputs:          Port set to 'Current Setting' window
  1349. *
  1350. * External Refs:    NONE
  1351. *
  1352. * Entry Points:     NONE
  1353. *
  1354. *******************************************************************************
  1355.                     using Globals
  1356.  
  1357.                     pha                 ; save the old port, as we are chang-
  1358.                     pha                 ; ing it below to erase the windows.
  1359.                     _GetPort
  1360.  
  1361. ; first erase and invalidate the Previous Print Record window
  1362.  
  1363.                     PushLong WindPointer2
  1364.                     _SetPort
  1365.  
  1366.                     PushLong #BigRect
  1367.                     _EraseRect
  1368.  
  1369.                     PushLong #BigRect
  1370.                     _InvalRect
  1371.  
  1372. ; Then erase and invalidate the current Print Record window.
  1373.  
  1374.                     PushLong WindPointer
  1375.                     _SetPort
  1376.  
  1377.                     PushLong #BigRect
  1378.                     _EraseRect
  1379.  
  1380.                     PushLong #BigRect
  1381.                     _InvalRect
  1382.  
  1383.                     _SetPort
  1384.  
  1385.                     rts
  1386.                     end
  1387.  
  1388.                     EJECT
  1389. *******************************************************************************
  1390. *
  1391. DisableAll          start
  1392. *
  1393. * Description:      Disables all menu items between 257 and 266. This includes
  1394. *                   virtually everything in the File Menu. This call will
  1395. *                   usually be followed by a call to re-enable one or two File
  1396. *                   items.
  1397. *
  1398. *
  1399. * Inputs:           NONE
  1400. *
  1401. * Outputs:          Menu items 257-266 disabled
  1402. *
  1403. * External Refs:    NONE
  1404. *
  1405. * Entry Points:     NONE
  1406. *
  1407. *******************************************************************************
  1408.                     using Globals
  1409.  
  1410.                     lda #257            ; start with the Quit item
  1411.                     sta MItemNum        ; save the index around the call
  1412. Loop                ANOP
  1413.                     pha                 ; push on for DisableItem
  1414.                     _DisableMItem
  1415.                     inc MItemNum        ; Bump to next Menu Item
  1416.                     lda MItemNum
  1417.                     cmp #267            ; finish with the Close Doc item
  1418.                     blt Loop
  1419.  
  1420.                     rts
  1421.  
  1422. MItemNum            ds 2
  1423.  
  1424.                     end
  1425.  
  1426.                     EJECT
  1427. *******************************************************************************
  1428. *
  1429. EnableAll           start
  1430. *
  1431. * Description:      Enables all menu items between 257 and 266. This includes
  1432. *                   virtually everything in the File Menu.
  1433. *
  1434. *
  1435. * Inputs:           NONE
  1436. *
  1437. * Outputs:          Menu items 257-266 enabled
  1438. *
  1439. * External Refs:    NONE
  1440. *
  1441. * Entry Points:     NONE
  1442. *
  1443. *******************************************************************************
  1444.                     using Globals
  1445.  
  1446.                     lda #257            ; start with the Quit item
  1447.                     sta MItemNum
  1448.  
  1449. Loop                pha
  1450.                     _EnableMItem
  1451.  
  1452.                     inc MItemNum
  1453.                     lda MItemNum
  1454.                     cmp #267            ; finish with the Close Doc item
  1455.                     blt Loop
  1456.  
  1457.                     rts
  1458.  
  1459. MItemNum            ds 2
  1460.  
  1461.                     end
  1462.  
  1463.                     END
  1464.